<!--
 * @Author: sueRimn
 * @Date: 2021-03-25 10:34:38
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-20 16:59:12
 * @Descripttion: 
-->
<template>
  <div class="divider-wrapper">
    <!-- <div class="divider-text-container" ref="title">
      <span>{{ dividerText }}</span>
    </div>
    <div class="divider-container-line" ref="line"></div>
    <div v-if="dividerDescribe !== ''" class="diliver-desc-container">
      {{ dividerDescribe }}
    </div> -->
    <div class="default-sample" v-if="activeConfig === 'first'">
      <div class="divider-title">
        <span ref="title" class="title" :style="{ color: titleColor }">{{
          dividerText
        }}</span>
      </div>
      <div class="divider-line" :style="{ background: dividerColor }"></div>
      <div class="divider-desc-info">
        {{ dividerDescribe }}
      </div>
    </div>
    <div class="default-sample" v-else-if="activeConfig === 'second'">
      <div class="divider-title">
        <span
          class="title"
          :style="{
            color: titleColor,
            borderBottom: `3px solid ${dividerColor}`
          }"
          >{{ dividerText }}</span
        >
      </div>
      <div
        class="divider-line"
        :style="{
          background: dividerColor
        }"
      >
        <span class="end-point" :style="{ background: dividerColor }"></span>
      </div>
      <div class="divider-desc-info">
        {{ dividerDescribe }}
      </div>
    </div>
    <div class="default-sample" v-else-if="activeConfig === 'third'">
      <div class="divider-title">
        <span class="bigArea" :style="{ background: titleBacColor }"></span>
        <span class="smallArea" :style="{ background: titleBacColor }"></span>
        <span class="title third-title" :style="{ color: titleColor }">{{
          dividerText
        }}</span>
      </div>
      <div
        class="divider-line"
        :style="{
          background: dividerColor
        }"
      >
        <div class="point-group">
          <span
            class="point"
            :style="{ background: dividerColor, opacity: 0.1 }"
          ></span>
          <span
            class="point"
            :style="{ background: dividerColor, opacity: 0.3 }"
          ></span>
          <span
            class="point"
            :style="{ background: dividerColor, opacity: 0.6 }"
          ></span>
        </div>
      </div>
      <div class="divider-desc-info">
        {{ dividerDescribe }}
      </div>
    </div>
    <div class="default-sample" v-else-if="activeConfig === 'fourth'">
      <div class="divider-title four-title">
        <span
          class="title four-inline-title"
          :style="{ color: titleColor, background: titleBacColor }"
          ><span class="start-point"></span>{{ dividerText }}</span
        >
      </div>
      <div
        class="divider-line fourth-line"
        :style="{ background: dividerColor }"
      ></div>
      <div class="divider-desc-info">
        {{ dividerDescribe }}
      </div>
    </div>
    <div class="default-sample" v-else-if="activeConfig === 'fifth'">
      <div class="divider-title fifth-title">
        <span
          class="title fifth-inline-title"
          :style="{ color: titleColor, background: titleBacColor }"
          >{{ dividerText }}
          <span
            class="right-triangle"
            :style="{ borderLeftColor: titleBacColor }"
          ></span
          ><span
            class="bottom-triangle"
            :style="{ borderTopColor: titleBacColor }"
          ></span
        ></span>
      </div>
      <div
        class="divider-line fourth-line"
        :style="{ background: dividerColor }"
      ></div>
      <div class="divider-desc-info">
        {{ dividerDescribe }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'formDivider',
  components: {},
  props: {
    dividerText: {
      type: String,
      default: () => {
        return '表单标题'
      }
    },
    dividerDescribe: {
      type: String,
      default: ''
    },
    titleColor: {
      type: String,
      default: '#191919'
    },
    dividerColor: {
      type: String,
      default: '#3053ea'
    },
    activeConfig: {
      type: String
    },
    titleBacColor: {
      type: String,
      default: '#3053ea'
    }
  },
  data() {
    return {}
  },
  computed: {},
  watch: {
    titleColor: {
      immediate: false,
      deep: false,
      handler(value) {
        this.titleColor = value
      }
    },
    dividerColor: {
      handler(value) {
        this.dividerColor = value
      },
      immediate: true
    },

    dividerDescribe: {
      handler(val) {
        this.dividerDescribe = val
      },
      immediate: true,
      deep: true
    },
    activeConfig: {
      handler(val) {
        this.activeConfig = val
      },
      immediate: true,
      deep: true
    }
  }
}
</script>
<style lang="scss" scoped>
.default-sample {
  position: relative;
}
.divider-title {
  position: relative;
  font-size: 16px;
  margin-top: -10px;
  padding-bottom: -1px;
}
.divider-line {
  position: absolute;
  top: 37px;
  left: 0;
  width: 100%;
  height: 1px;
}
.fourth-line {
  top: 32px;
}
.divider-desc-info {
  height: 24px;
  margin: 6px 0 -5px;
  line-height: 24px;
  font-size: 14px;
  color: #999999;
}
.title {
  display: inline-block;
}
.four-title {
  margin-top: -5px;
  margin-bottom: -6px;
  font-weight: 700;
}
.fifth-title {
  margin-top: -5px;
  margin-bottom: -6px;
  font-weight: 700;
}
.four-inline-title {
  display: inline-block;
  height: 30px;
  line-height: 30px;
  background-color: #3053ea;
  border-top-right-radius: 15px;
  padding: 0 16px 5px 8px !important;
}
.fifth-inline-title {
  position: relative;
  display: inline-block;
  height: 30px;
  line-height: 30px;
  padding: 0 10px;
  background-color: #3053ea;
}
.right-triangle {
  position: absolute;
  right: -26px;
  top: 0;
  display: inline-block;
  width: 0;
  height: 0;
  border: 15px solid transparent;
  border-left: 12px solid #3053ea;
}
.bottom-triangle {
  position: absolute;
  left: 0;
  bottom: -5px;
  display: inline-block;
  width: 0;
  height: 0;
  border-top: solid 5px #3053ea;
  border-left: solid 9px transparent;
}
.end-point {
  position: absolute;
  top: -1px;
  right: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
}
.point-group {
  position: absolute;
  right: 0;
  top: -5px;
  display: flex;
  justify-self: end;
  .point {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    margin-left: 2px;
  }
}
.bigArea {
  position: absolute;
  bottom: 11px;
  left: 0;
  width: 24px;
  height: 24px;
  background: #3053ea;
  border-radius: 2px;
  opacity: 0.16;
}
.smallArea {
  position: absolute;
  bottom: 11px;
  width: 8px;
  height: 8px;
  background: #3053ea;
  border-radius: 1px;
}
.third-title {
  padding-left: 12px;
}
.start-point {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #fff;
  border-radius: 50%;
  margin-right: 7px;
}
</style>
